<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>

</head>
<body>
  <div id="app">
    输入体重单位(kg):
    <input type="number" v-model="weight">
    输入身高单位(m):
    <input type="number" v-model="height">
    结果： {{bmi}}
    
  </div>
  <script src="./vue.global.js"></script>
  <script>
    const { createApp } = Vue;
    const  app = createApp({
      data(){
        return {
          weight: 0,
          height: 0
        }
      },
      computed: {
        bmi(){
          const bmi = this.weight / (this.height * this.height);
          if (bmi < 18.5) {
            return '营养不良'
          } else if (bmi < 25) {
            return '正常'
          } else if (bmi < 30) {
            return '超重'
          } else {
            return '肥胖'
          }
        }
      }
    })

    app.mount('#app')
  </script>
</body>
</html>